<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>查询水表数据列表</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css" href="../bootstrap/dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" href="../css/fileinput.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/public.css" />
	</head>
	<style type="text/css">
		.remove {
			cursor: pointer;
		}
		
		.remove:hover {
			/*color: red;*/
		}
		
		.pagination span {
			font: 14px/34px "";
			padding: 0 5px;
		}
		
		.form-control {
			display: inline-block;
			width: 120px;
		}
		
		.search {
			width: 155px;
		}
		
		.header {
			/*border-bottom: 1px solid #fefefe;*/
		}
		
		.header span {
			padding: 0 5px;
		}
		
		ul {
			display: block;
			list-style-type: disc;
			margin-block-start: 0em;
			margin-block-end: 0em;
			margin-inline-start: 0px;
			margin-inline-end: 0px;
			padding-inline-start: 0px;
		}
		
		li {
			list-style-type: none;
			display: flex;
			justify-content: flex-start;
			border-bottom: 1px solid #ebebeb;
			font: 14px/28px "";
		}
		
		li span {
			display: inline-block;
			width: 20%;
		}
		
		.table_cla {
			height: 560px;
		}
	</style>

	<body>
		<div id="app" style="width: 100%; margin: 0 auto;padding:0 20px;">
			<div class="header" style="margin-top: 20px;">
				<!--<span>楼宇：</span>-->
				<select name="" class="form-control" v-model="build_model" @change="buildchange">
					<option v-for="index in build" :value="index.id" v-text="index.buildname"></option>
				</select>
				<!--<span>单元：</span>-->
				<select name="" class="form-control" v-model="unit_model" @change="unitchange">
					<option v-for="index in unit" :value="index.id" v-text="index.unitname"></option>
				</select>
				<!--<span>楼层：</span>-->
				<select name="" class="form-control" v-model="floor_model" @change="floorchange">
					<option v-for="index in floor" :value="index.id" v-text="index.floorname"></option>
				</select>
				<!--<span>房号：</span>-->
				<select name="" class="form-control" v-model="room_model">
					<option v-for="index in room" :value="index.rommid" v-text="index.rommcode"></option>
				</select>
				<!--<select name="" class="form-control" v-model="rechresult">
					<option v-for="index in leixing" :value="index.id" v-text="index.name"></option>
				</select>-->
				<input style="width: 155px;" type="text" class="form-control" name="search1" id="search1" value="" v-model="searchmain" placeholder="请输入水表号或房号" />
				<button type="button" class="btn btn-info" data-dismiss="modal" @click="search">搜索</button>
				<button type="button" class="btn btn-info" data-toggle="modal" data-target="#add_water_meter" @click="add_water_meter">添加水表</button>
			</div>
			<div class="table_cla">
				<table class="table">
					<caption>查询水表数据列表</caption>
					<thead>
						<tr>
							<th>楼宇名称</th>
							<th>单元号</th>
							<th>楼层</th>
							<th>房间号</th>
							<th>业主</th>
							<th>表号</th>
							<th>读表度数</th>
							<th>今年共用吨数</th>
							<!--<th>共买金额</th>
							<th>共用金额</th>-->
							<th>状态 </th>
							<th>水价类型</th>
							<th>操作 </th>
						</tr>
					</thead>
					<tbody>
						<tr v-for="(tt,index) in table">
							<td v-text="tt.buildname"></td>
							<td v-text="tt.units"></td>
							<td v-text="tt.floor"></td>
							<td v-text="tt.rommcode"></td>
							<td v-text="tt.custname"></td>
							<td v-text="tt.watchno"></td>
							<td v-text="tt.lastreadnum"></td>
							<td v-text="tt.thisyearusernum"></td>
							<!--<td v-text="tt.totalbuywaternum"></td>-->
							<!--<td v-text="tt.toteluserwaternum"></td>-->
							<td v-text="tt.watchstate"></td>
							<td v-text="tt.issetprice"></td>
							<td class="remove">
								<!--<span v-if="panduan" @click="sure_more(tt)" class="glyphicon glyphicon-align-justify">详情</span>
								<span v-if="panduan" class="glyphicon glyphicon-trash">删除</span>-->
								<span v-if="panduan" data-toggle="modal" data-target="#myModalremove" style="color: #286090;" @click="sure_more(tt)" class="glyphicon glyphicon-align-justify">详情&nbsp;</span>
								<span v-if="panduan" @click="fix_water_meter(tt)" data-toggle="modal" data-target="#fix_water_meter" style="color: #f0ad4e;" class="glyphicon glyphicon-pencil">修改&nbsp;</span>
								<span v-if="panduan" data-toggle="modal" data-target="#remove_water_meter" @click="remove_water_meter(tt)" style="color: #d43f3a;" class="glyphicon glyphicon-trash">删除&nbsp;</span>
								<span v-if="panduan" @click="replace_water_meter(tt)" data-toggle="modal" data-target="#replace_water_meter" style="color: #5bc0de;" class="glyphicon glyphicon-refresh">换表&nbsp;</span>

							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<ul class="pagination">
				<span v-text="count_all"></span>
				<!--<li v-show="current != 1" @click="current-- && goto(current--)">
					<a href="#">上一页</a>
				</li>-->
				<li v-for="index in pages" @click="goto(index)" :class="{'active':current == index}" :key="index">
					<a href="#" v-text="index"></a>
				</li>
				<!--<li v-show="allpage != current && allpage != 0 " @click="current++ && goto(current++)">
					<a href="#">下一页</a>
				</li>-->
				<span>跳到:</span>
				<input style="width: 50px;height: 28px;" name="goto" id="goto" v-model="jump" type="text" name="" oninput="value=value.replace(/[^\d]/g,'')">
				<!--<input style="width: 50px;height: 34px;" min="1" max="{{allpage}}" type="number" name="goto" id="goto" v-model="jump" />-->
				<span>页</span>
				<button type="button" id="gotoo" @click="goto(jump)" class="btn btn-danger ">确定 </button>
			</ul>
			<!-- 模态框（Modal）详情 -->
			<div class="modal fade" id="myModalremove" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">水表数据详情</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>表具id:</span><label v-text="model_data.equipsid"></label>
								</li>
								<li>
									<span>创建时间:</span><label v-text="model_data.createdate"></label>
								</li>
								<li>
									<span>厂商名 :</span><label v-text="model_data.factoryid"></label>
								</li>
								<li>
									<span>安装位置: </span><label v-text="model_data.instadr"></label>
								</li>
								<li>
									<span>安装时间 :</span><label v-text="model_data.instdate"></label>
								</li>
								<li v-if="model_data.issetprice1==0">
									<span>单价 :</span><label v-text="3.8+'元'"></label>
								</li>
								<li v-if="model_data.issetprice1==1">
									<span>单价: </span><label v-text="model_data.price1+'元' "></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯一:</span><label v-text="model_data.ladder1+'吨'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯二:</span><label v-text="model_data.ladder2+'吨'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯三:</span><label v-text="model_data.ladder3+'吨'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯价格 1:</span><label v-text="model_data.price1+'元'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯价格 2:</span><label v-text="model_data.price2+'元'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯价格 3:</span><label v-text="model_data.price3+'元'"></label>
								</li>
								<li v-if="model_data.issetprice1==2">
									<span>阶梯价格 4:</span><label v-text="model_data.price4+'元'"></label>
								</li>
								<li v-if="kind==1">
									<span>总购水:</span><label v-text="model_data.totalbuywaternum+'元'"></label>
								</li>
								<li v-if="kind==1">
									<span>总用水:</span><label v-text="model_data.toteluserwaternum+'元'"></label>
								</li>
								<li v-if="model_data.remarks">
									<span>换表备注：</span>
									<textarea name="" v-model="model_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div v-if="kind==1" class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<!--<button type="button" class="btn btn-danger remove" @click="surepay">确定充值</button>-->
						</div>
						<div v-if="kind==2" class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="water_meter_open" @click="water_meter_open" class="btn btn-info remove">开阀</button>
							<button type="button" id="water_meter_close" @click="water_meter_close" class="btn btn-info remove">关阀</button>
							<button type="button" id="meter_info_search" @click="meter_info_search" data-toggle="modal" data-target="#myModal_meter_info" @click="meter_info_search" class="btn btn-info remove">读水表数据</button>
						</div>

					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）读shui表数据 -->
			<div class="modal fade" id="myModal_meter_info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">水表数据</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>表具类型:</span><label v-text="meter_info.kind"></label>
								</li>
								<li v-if="kind_panduan==1">
									<span>余额:</span><label v-text="meter_info.balance+'元'"></label>
								</li>
								<li v-if="kind_panduan==1">
									<span>抄表吨数 :</span><label v-text="meter_info.lastreadnum+'吨'"></label>
								</li>
								<li v-if="kind_panduan==1">
									<span>总购金额: </span><label v-text="meter_info.totalbuywaternum+'元'"></label>
								</li>
								<li v-if="kind_panduan==1">
									<span>总用金额 :</span><label v-text="meter_info.toteluserwaternum+'元'"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>阀门状态  :</span><label v-text="meter_info.switchstatus"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>运行状态  :</span><label v-text="meter_info.runsts"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>异常描述 :</span><label v-text="meter_info.erdes"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>最后抄读时间 :</span><label v-text="meter_info.indate"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>最后抄读数 :</span><label v-text="meter_info.innum+'吨'"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>总购量 :</span><label v-text="meter_info.totaldosage+'吨'"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>总用量 :</span><label v-text="meter_info.totalused+'吨'"></label>
								</li>
								<li v-if="kind_panduan==2">
									<span>剩余量 :</span><label v-text="meter_info.surplusdosage+'吨'"></label>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<!--<button type="button" class="btn btn-danger remove" @click="surepay">确定充值</button>-->
						</div>

					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）添加水表 -->
			<div class="modal fade" id="add_water_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">添加水表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*选择楼宇：</span>
									<select name="" v-model="build_model" class="form-control" @change="buildchange">
										<option v-for="index in build" :value="index.id" v-text="index.buildname"></option>
									</select>
								</li>
								<li>
									<span>*选择单元：</span>
									<select name="" class="form-control" v-model="unit_model" @change="unitchange">
										<option v-for="index in unit" :value="index.id" v-text="index.unitname"></option>
									</select>
								</li>
								<li>
									<span>*选择楼层：</span>
									<select name="" class="form-control" v-model="floor_model" @change="floorchange">
										<option v-for="index in floor" :value="index.id" v-text="index.floorname"></option>
									</select>
								</li>
								<li>
									<span>*选择房号：</span>
									<select name="" class="form-control" v-model="room_model">
										<option v-for="index in room" :value="index.rommid" v-text="index.rommcode"></option>
									</select>
								</li>
								<li>
									<span>*厂商名称：</span>
									<select id="vendor_name_fix" @change="vendor_name_changge" v-model="vendor" style="display: inline-block;" class="form-control">
										<option v-for="item in vendor_name" :value="item.itemname" v-text="item.itemname"></option>
									</select>
								</li>
								<li>
									<span>*安装时间：</span>
									<input class="time-input form-control" type="text" placeholder="点击选择安装时间" id="datetimepicker" v-model="add_data.instdate">
								</li>
								<li>
									<span>旧表表号：</span>
									<input class="form-control" type="text" v-model="add_data.oldwatchno" placeholder="之前有表请输入旧表号" />
								</li>
								<li>
									<span>旧表照片：</span>
								</li>
								<form id="Form1" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile" name="pic" type="file" class="file">
								</form>
								<li>
									<span>*设置价格：</span>
									<select id="" v-model="add_data.issetprice" style="display: inline-block;" @change="issetprice_change" class="form-control">
										<option value="">请选择计费类型</option>
										<option v-for="item in issetprice" :value='item.id' v-text="item.value"></option>
									</select>
								</li>
								<li v-if="vendor_name_name==1">
									<span>*集中器号：</span>
									<select name="" v-model="mustcode" class="form-control">
										<option v-for="index in mustcode_name" :value="index.mustcode" v-text="index.mustcodename+index.mustcode"></option>
									</select>
									<!--<input class="form-control" type="text" v-model="add_data.ipadder" placeholder="请输入输入新表号" />-->
								</li>
								<li v-if="vendor_name_name==1">
									<span>*线路号 ：</span>
									<input class="form-control" type="text" v-model="add_data.port" placeholder="请输入线路号" />
								</li>
								<li>
									<span>*输入新表号：</span>
									<input class="form-control" type="text" v-model="add_data.watchno" placeholder="请输入输入新表号" />
								</li>
								<li>
									<span>*安装位置：</span>
									<input class="form-control" type="text" v-model="add_data.instadr" placeholder="请输入安装位置" />
								</li>
								<li v-if="issetprice1==2">
									<span>今年用水量：</span>
									<input class="form-control" type="text" v-model="add_data.thisyearusernum" placeholder="请输入今年用水量'单位吨'" />
								</li>
								<li v-if="issetprice1==1">
									<span>*单价：</span>
									<input class="form-control" type="text" v-model="add_data.price1" placeholder="请输入单价 '单位元'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*价格1：</span>
									<input class="form-control" type="text" v-model="add_data.price1" placeholder="请输入价格1 '单位元'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*价格2：</span>
									<input class="form-control" type="text" v-model="add_data.price2" placeholder="请输入价格2 '单位元'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*价格3：</span>
									<input class="form-control" type="text" v-model="add_data.price3" placeholder="请输入价格3 '单位元'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*价格4：</span>
									<input class="form-control" type="text" v-model="add_data.price4" placeholder="请输入价格4 '单位元'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*阶梯1：</span>
									<input class="form-control" type="text" v-model="add_data.ladder1" placeholder="请输入阶梯1 '单位吨'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*阶梯2：</span>
									<input class="form-control" type="text" v-model="add_data.ladder2" placeholder="请输入阶梯2 '单位吨'" />
								</li>
								<li v-if="issetprice1==2">
									<span>*阶梯3：</span>
									<input class="form-control" type="text" v-model="add_data.ladder3" placeholder="请输入阶梯3 '单位吨'" />
								</li>
								<li>
									<span>初始充量：</span>
									<input class="form-control" type="text" v-model="add_data.initnum" placeholder="请输入初始充量 '单位吨'" />
								</li>
								<li>
									<span>表读数：</span>
									<input class="form-control" type="text" v-model="add_data.lastreadnum" placeholder="请输入表读数 '单位吨'" />
								</li>
								<li>
									<span>换表备注：</span>
									<!--<input type="text" placeholder="如果之前有旧表请输入备注！" v-model="add_data.remarks"/>-->
									<textarea name="" v-model="add_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="add_water_meter_sure" class="btn btn-danger remove" @click="add_water_meter_sure">确定添加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）修改水表 -->
			<div class="modal fade" id="fix_water_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">修改水表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">
								<li>
									<span>*设置价格：</span>
									<select id="" v-model="issetprice2" style="display: inline-block;" class="form-control">
										<option value="">请选择计费类型</option>
										<option value="1">单价</option>
										<option value="2">阶梯价</option>
									</select>
								</li>
								<li>
									<span>*安装位置：</span>
									<input class="form-control" type="text" v-model="fix_data.instadr" placeholder="请输入安装位置" />
								</li>
								<li>
									<span>今年用水量：</span>
									<input class="form-control" type="text" v-model="fix_data.thisyearusernum" placeholder="请输入今年用水量 '单位吨'" />
								</li>
								<li v-if="issetprice2==1">
									<span>*单价：</span>
									<input class="form-control" type="text" v-model="fix_data.price1" placeholder="请输入单价 '单位元'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*价格1：</span>
									<input class="form-control" type="text" v-model="fix_data.price1" placeholder="请输入价格1 '单位元'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*价格2：</span>
									<input class="form-control" type="text" v-model="fix_data.price2" placeholder="请输入价格2 '单位元'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*价格3：</span>
									<input class="form-control" type="text" v-model="fix_data.price3" placeholder="请输入价格3 '单位元'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*价格4：</span>
									<input class="form-control" type="text" v-model="fix_data.price4" placeholder="请输入价格4 '单位元'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*阶梯1：</span>
									<input class="form-control" type="text" v-model="fix_data.ladder1" placeholder="请输入阶梯1 '单位吨'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*阶梯2：</span>
									<input class="form-control" type="text" v-model="fix_data.ladder2" placeholder="请输入阶梯2 '单位吨'" />
								</li>
								<li v-if="issetprice2==2">
									<span>*阶梯3：</span>
									<input class="form-control" type="text" v-model="fix_data.ladder3" placeholder="请输入阶梯3 '单位吨'" />
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="fix_water_meter_sure" class="btn btn-danger remove" @click="fix_water_meter_sure">确定修改</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）更换水表 -->
			<div class="modal fade" id="replace_water_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">更换水表</h4>
						</div>
						<div class="modal-body">
							<ul id="te_ul">

								<li>
									<span>*旧表表号：</span>
									<input class="form-control" type="text" v-model="old_watchno" disabled="disabled" />
								</li>
								<li>
									<span>*新表表号：</span>
									<input class="form-control" type="text" v-model="replace_data.watchno" placeholder="请输入新表表号" />
								</li>
								<li>
									<span>*新表读数：</span>
									<input class="form-control" type="text" v-model="replace_data.lastreadnum" placeholder="请输入新表读数 '单位吨'" />
								</li>
								<li>
									<span>*初始充量：</span>
									<input class="form-control" type="text" v-model="replace_data.initnum" placeholder="请输入初始充量 '单位吨'" />
								</li>
								<li>
									<span>旧表照片：</span>
								</li>
								<form id="Form2" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile1" name="pic" type="file" class="file">
								</form>
								<li>
									<span>换表备注：</span>
									<!--<input type="text" placeholder="如果之前有旧表请输入备注！" v-model="add_data.remarks"/>-->
									<textarea name="" v-model="replace_data.remarks" rows="" cols=""></textarea>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="replace_water_meter_sure" class="btn btn-danger remove" @click="replace_water_meter_sure">确定更换</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 模态框（Modal）提示信息 -->
			<div class="modal fade" id="myModal_tips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">提示信息</h4>
						</div>
						<div class="modal-body" id="tips" v-text="tips_modal">

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
			<!-- 确认删除 -->
			<div style="z-index: 1048;" class="modal fade" id="remove_water_meter" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">是否确认删除</h4>
						</div>
						<div class="modal-body">删除后数据无法找回</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" class="btn btn-danger remove" @click="sureremove">确定删除</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
		</div>
	</body>

</html>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-datetimepicker.zh-CN.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/fileinput.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/zh.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function() {
		$("#Form1 .file-drop-zone-title").html("上传旧表照片");
	})
</script>
<script>
	new Vue({
		el: '#app',
		data: {
			val_te: "",
			urlr: "",
			yanli_url: '',
			get_upload: "",
			current: 1,
			showItem: 5,
			rechresult: "",
			allpage: "",
			jump: "",
			userid: "",
			count_all: '',
			model_data: "",
			show_caozuo: false,
			tips_modal: "",
			vendor: "",
			kind: 0,
			areaid: "",
			instdate: "",
			searchmain: "",
			panduan: true,
			token: "",
			issetprice1: 0,
			issetprice2: 0,
			replace_data: {},
			kind_panduan: '',
			fix_data: {},
			add_data: {
				lastreadnum: 0,
				initnum: 0,
				thisyearusernum: 0,
				rommid: '',
				watchno: '',
				instdate: '',
				instadr: '',
				createuserid: '',
				createusername: '',
				factoryid: '',
				issetprice: '',
				initnum: '',
				price1: '',
				price2: '',
				price3: '',
				price4: '',
				ladder1: '',
				ladder2: '',
				ladder3: '',
				oldwatchno: '',
				thisyearusernum: ''
			},
			vendor_name: [{
				id: "请选择厂商名字",
				areaname: "请选择厂商名字"
			}],
			mustcode:'',
			mustcode_name:[
			{
				mustcode: "",
				mustcodename: "请选择集中器号"
			}
			],
			meter_info: {},
			old_watchno: "",
			merchantid: "",
			goodsid: '',
			leixing: [{
				name: '全部',
				id: ""
			}, {
				name: '充值成功',
				id: "1"
			}, {
				name: '充值失败',
				id: "2"
			}, {
				name: '充值中',
				id: "3"
			}, ],
			imgpath: "",
			imgpath1: "",
			leixing_model: "",
			payid: "",
			issetprice: [{
				id: 1,
				value: '单价'
			}, {
				id: 2,
				value: '阶梯价'
			}, ],
			lou: [{
				buildname: '请选择楼宇',
				id: ""
			}],
			lou_model: "",
			danyuan: [{
				unitname: '请选择单元',
				id: ""
			}],
			danyuan_model: '',
			table: [{

				},

			],
			data_remove: {},
			build: [{
				buildname: '请选择楼宇',
				id: ""
			}],
			build_model: "",
			unit: [{
				unitname: '请选择单元',
				id: ""
			}],
			unit_model: '',
			floor: [{
				floorname: '请选择楼层',
				id: ""
			}],
			floor_model: '',
			room: [{
				rommcode: '请选择房号',
				rommid: ""
			}],
			vendor_name_name: "",
			room_model: '',
		},
		//计算属性
		computed: {

		},
		created: function() {
			var that = this;
			that.yanli_url = getUrl_yangli();
			that.urlr = getUrl();
			that.get_upload = get_upload();
			that.build_model = that.build[0].id;
			that.unit_model = that.unit[0].id;
			that.floor_model = that.floor[0].id;
			that.room_model = that.room[0].rommid;
			that.mustcode = that.mustcode_name[0].mustcode;
		},
		mounted: function() {
			var that = this;
			this.lou_model = this.lou[0].id;
			this.danyuan_model = this.danyuan[0].id;
			this.leixing_model = this.leixing[0].id;
			var userid = getUrlParam('userid');
			this.userid = userid;
			var createusername = getUrlParam('realname');
			this.createusername = createusername;
			var merchantid = getUrlParam('merchantid');
			this.merchantid = merchantid;
			var areaid = getUrlParam('areaid');
			this.areaid = areaid;
			var token = getUrlParam('token');
			this.token = token;
			var goodsid = getUrlParam('goodsid');
			this.goodsid = goodsid;
			if(userid == null || userid == '') {
				this.tips_modal = "用户id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(createusername == null || createusername == '') {
				this.tips_modal = "用户姓名不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(areaid == null || areaid == '') {
				this.tips_modal = "小区id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(merchantid == null || merchantid == '') {
				this.tips_modal = "物业id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(merchantid == null || merchantid == '') {
				this.tips_modal = "物业id不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			if(goodsid == null || goodsid == '') {
				this.tips_modal = "goodsid不能为空";
				$('#myModal_tips').modal('show');
				this.val_te = true;
				return;
			}
			that.build_model = that.build[0].id;
			that.unit_model = that.unit[0].id;
			that.floor_model = that.floor[0].id;
			that.room_model = that.room[0].rommid;
			that.vendor = that.vendor_name[0].id;
			that.add_data.issetprice = '';
			var datainit = {
				pagenumber: 1,
				pagesize: 10,
				areaid: this.areaid,
				buildid: this.build_model,
				unitid: this.unit_model,
				rommid: this.room_model,
				floor: this.floor_model,
				selectinfo: this.searchmain,
			};
			if(this.val_te != true) {
				this.jiazai(datainit);
				this.lou_info(this.areaid)
				this.table = ""
			}
			that.upload_img();
			that.upload_img1();
			that.data_time_init();
			that.mustcode_info();
		},
		computed: {
			pages: function() {
				var pag = [];
				if(this.current < this.showItem) { //如果当前的激活的项 小于要显示的条数
					//总页数和要显示的条数那个大就显示多少条
					var i = Math.min(this.showItem, this.allpage);
					while(i) {
						pag.unshift(i--);
					}
				} else { //当前页数大于显示页数了
					var middle = this.current - Math.floor(this.showItem / 2), //从哪里开始
						i = this.showItem;
					if(middle > (this.allpage - this.showItem)) {
						middle = (this.allpage - this.showItem) + 1
					}
					while(i--) {
						pag.push(middle++);
					}
				}
				return pag
			},
		},
		methods: {
			//提示
			tips: function(data) {
				var that = this;
				that.tips_modal = data;
				$('#myModal_tips').modal('show');
			},
			//选择价格改变
			issetprice_change: function() {
				var that = this;
				if(that.add_data.issetprice == 1) {
					that.issetprice1 = 1
				} else if(that.add_data.issetprice == 2) {
					that.issetprice1 = 2
				}
			},
			//日期
			data_time_init: function() {
				var d, s;
				var self = this;
				self.start = s;
				$('#datetimepicker').datetimepicker({
					minView: "month", //选择日期后，不会再跳转去选择时分秒 
					language: 'zh-CN',
					format: 'yyyy-mm-dd',
					todayBtn: 1,
					autoclose: 1,
				});
				//隐藏的同时绑定数据
				$("#datetimepicker").datetimepicker().on('hide', function(ev) {
					var startTime = $("#datetimepicker").val();
					self.add_data.instdate = startTime;
				});

			},
			//上传图片
			upload_img: function() {
				var that = this;
				$("#uploadfile").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.get_upload + "/woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.imgpath = bb[0].url;
					console.log(that.imgpath);
				});
			},
			//上传图片
			upload_img1: function() {
				var that = this;
				$("#uploadfile1").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.get_upload + "/woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.imgpath1 = bb[0].url;
					console.log(that.imgpath1);
				});
			},
			//获取楼宇
			lou_info: function(areaid) {
				var that = this;
				var data = JSON.stringify({
					parentid: that.areaid
				})
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/public/selectBuildList",
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var aa = JSON.parse(msg.returnString);
							var te = {
								buildname: '请选择楼宇',
								id: ""
							}
							aa.unshift(te);
							that.build = aa;
							that.build_model = that.build[0].id;
						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//楼改变请求单元
			buildchange: function() {
				this.unil_info(this.build_model);
			},
			//获取单元
			unil_info: function(areaid) {
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectUnitsList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									unitname: '请选择单元',
									id: ""
								}
								aa.unshift(te);
								that.unit = aa;
								that.unit_model = that.unit[0].id;
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			/*单元改变*/
			unitchange: function() {
				this.floor_info(this.unit_model);
			},
			//获取楼层
			floor_info: function(areaid) {
				if(areaid != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",
						type: "POST",
						url: that.urlr + "/public/selectFloors",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									floorname: '请选择楼层',
									id: ""
								}
								var flloor = [];
								for(var i = 1; i <= aa; i++) {
									var main = {
										floorname: i + "层",
										id: i
									}
									flloor.push(main)
								}
								flloor.unshift(te);
								that.floor = flloor;
								that.floor_model = that.floor[0].id;
							} else {
								//							alert(msg.disp)
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							//						alert("获取信息失败");
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}

			},
			//楼层改变
			floorchange: function() {
				var that = this;
				if(this.unit_model == '' || this.floor_model == '') {
					var aa = [];
					var te = {
						rommcode: '请选择房号',
						rommid: ""
					}
					aa.unshift(te);
					that.room = aa;
					that.room_model = that.room[0].rommid;
				} else {
					this.room_info(this.unit_model, this.floor_model);
				}
			},
			//出现房屋
			room_info: function(areaid, floor_c) {
				if(areaid != "" || floor_c != "") {
					var that = this;
					var data = JSON.stringify({
						parentid: areaid,
						floor: floor_c
					})
					$.ajax({
						contentType: "application/json; charset=utf-8",

						type: "POST",
						url: that.urlr + "/public/selectRoomCodeList",
						data: data,
						async: true,
						dataType: "json",
						success: function(msg) {
							//							console.log(msg);
							if(msg.code == 200) {
								var aa = JSON.parse(msg.returnString);
								var te = {
									rommcode: '请选择房号',
									rommid: ""
								}
								aa.unshift(te);
								that.room = aa;
								that.room_model = that.room[0].rommid;
							} else {
								that.tips_modal = msg.disp;
								$('#myModal_tips').modal('show');
							}
						},
						error: function() {
							that.tips_modal = "获取信息失败";
							$('#myModal_tips').modal('show');
						}
					});
				}
			},
			//加载数据
			jiazai: function(e) {
				//				console.log(e)			
				var data = JSON.stringify(e);
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/selectWaterInfoList",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						//						console.log(msg);
						if(msg.code == 200) {
							var data = JSON.parse(msg.returnString);
							//														console.log(data);
							for(var i = 0; i < data.length; i++) {
								if(data[i].watchstate == 1) {
									data[i].watchstate = '正常'
								} else if(data[i].watchstate == 2) {
									data[i].watchstate = "未开闸 "
								}
								data[i].issetprice1 = data[i].issetprice;
								if(data[i].issetprice == 0) {
									data[i].issetprice = '未设置 ';
								} else if(data[i].issetprice == 1) {
									data[i].issetprice = "单价"
								} else if(data[i].issetprice == 2) {
									data[i].issetprice = "阶梯价"
								}
								if(data[i].rechresult == 1) {
									data[i].rechresult1 = "充值成功"
								} else if(data[i].rechresult == -1) {
									data[i].rechresult1 = "充值失败 "

								} else if(data[i].rechresult == 0) {
									data[i].rechresult1 = "充值中"
								}
								if(data[i].billstatus == 1) {
									data[i].billstatus = "已完成(成功支付)"
								} else if(data[i].billstatus == 2) {
									data[i].billstatus = "已取消 "
								} else if(data[i].billstatus == 3) {
									data[i].billstatus = "已退款"
								} else if(data[i].billstatus == 4) {
									data[i].billstatus = "缴费失败，已退款"
								} else if(data[i].billstatus == 5) {
									data[i].billstatus = "缴费失败，系统自主退款失败"
								}

							}
							//							console.log(coouuntt)

							that.table = data;
							that.count_all = "共" + msg.count + "条"
							var yu = msg.count % 10;
							if(yu == 0) {
								that.allpage = parseInt(msg.count / 10);
							} else {
								that.allpage = parseInt(msg.count / 10) + 1;
							}

						} else {
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});

			},
			//跳页
			goto: function(index) {
				if(index == this.current) return;
				if(index > this.allpage) {
					return
				}
				//				debugger
				var re = /^[1-9]+[0-9]*]*$/ //判断正整数      // /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字  
				if(!re.test(index)) {
					return false;
				}
				this.current = index;
				var datainit = {
					pagenumber: index,
					pagesize: 10,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.room_model,
					floor: this.floor_model,
					selectinfo: this.searchmain,

				};

				this.jiazai(datainit);
				//这里可以发送ajax请求
			},
			search: function() {
				var that = this;
				var datainit = {
					pagenumber: 1,
					pagesize: 10,
					areaid: this.areaid,
					buildid: this.build_model,
					unitid: this.unit_model,
					rommid: this.room_model,
					floor: this.floor_model,
					selectinfo: this.searchmain,
				}
				if(that.val_te != true) {
					this.jiazai(datainit);
					that.current=1;
				} else {
					//					alert("非法登录");
					that.tips_modal = "非法登录";
					$('#myModal_tips').modal('show');
				}
			},
			sure_more: function(data) {
				var that = this;
				that.model_data = data;
				console.log(that.model_data.equipsid);
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/selectWaterInfo",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.code == 200) {
							var data_msg = JSON.parse(msg.returnString);
							that.kind = data_msg.kind;
							console.log(that.kind);
						} else {
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			add_water_meter: function() {
				var that = this;
				that.get_vendor_name();
			},
			//获取厂商名字
			get_vendor_name: function() {
				var that = this;
				that.vendor = that.vendor_name[0].id;
				var data = JSON.stringify({
					fullname: "",
					requestString: JSON.stringify({
						itemname: "水表厂商名字"
					}),
					userId: ''
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + '/public/selectDataItemByItemcode',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						console.log(msg)
						if(msg.responseCode == 200) {
							console.log(msg)
							that.vendor_name = JSON.parse(msg.returnString);
							that.vendor_name.unshift({
								id: "请选择厂商名字",
								itemname: "请选择厂商名字"
							});
							that.vendor = that.vendor_name[0].id;
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			/*获取集中器名字*/
			mustcode_info: function() {				
				var that = this;
				var data = JSON.stringify({
					areaid: that.areaid
				})
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/selectMustCode",
					data: data,
					async: true,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					dataType: "json",
					success: function(msg) {	
						console.log(msg)
						if(msg.code == 200) {
							var aa = JSON.parse(msg.returnString);
							var te = {
								mustcode: '',
								mustcodename: "请选择集中器号"
							}
							aa.unshift(te);
							that.mustcode_name = aa;
							that.mustcode = that.mustcode_name[0].mustcode;
						} else {
							//							alert(msg.disp)
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						//						alert("获取信息失败");
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//水表厂商名称改变，如果是诺文，多两个参数
			vendor_name_changge: function() {			
				var that = this;
				if(that.vendor == '诺文') {
					that.vendor_name_name = 1;
				} else {
					that.vendor_name_name = 2;
				}
			},
			//增加水表
			add_water_meter_sure: function() {
				var that = this;
				that.add_data.ipadder = that.mustcode;
				that.add_data.rommid = that.room_model;
				that.add_data.createuserid = that.userid;
				that.add_data.createusername = that.createusername;
				that.add_data.factoryid = that.vendor;
				var data = JSON.stringify(that.add_data);
				if(that.add_data.rommid == '') {
					that.tips("请先选择房间");
					return;
				}
				if(that.add_data.factoryid == '请选择厂商名字') {
					that.tips("请选择厂商名字");
					return;
				}
				if(that.add_data.instdate == '') {
					that.tips("请先选择安装时间");
					return;
				}
				if(that.add_data.watchno == '') {
					that.tips("请先输入新表号");
					return;
				}
				if(that.add_data.instadr == '') {
					that.tips("请先选择安装位置");
					return;
				}
				if(that.add_data.issetprice == '') {
					that.tips("请先选择计费类型");
					return;

				}
				if(that.add_data.issetprice == 1) {
					if(that.add_data.price1 == '') {
						that.tips("请先输入价格");
						return;
					}

				}
				if(that.add_data.issetprice == 2) {
					if(that.add_data.price1 == '') {
						that.tips("请先输入价格1");
						return;
					}
					if(that.add_data.price2 == '') {
						that.tips("请先输入价格2");
						return;
					}
					if(that.add_data.price3 == '') {
						that.tips("请先输入价格3");
						return;
					}
					if(that.add_data.price4 == '') {
						that.tips("请先输入价格4");
						return;
					}
					if(that.add_data.ladder1 == '') {
						that.tips("请先输入阶梯1");
						return;
					}
					if(that.add_data.ladder2 == '') {
						that.tips("请先输入阶梯2");
						return;
					}
					if(that.add_data.ladder3 == '') {
						that.tips("请先输入阶梯3");
						return;
					}
				}
				if(that.add_data.issetprice == 1) {
					that.add_data.price2 == '';
					that.add_data.price3 == '';
					that.add_data.price4 == '';
					that.add_data.ladder1 == '';
					that.add_data.ladder2 == '';
					that.add_data.ladder3 == '';
					that.add_data.thisyearusernum == '';
				}
				if(that.add_data.issetprice == 2) {
					that.add_data.price1 == '';
				}
//				vendor_name_name
				if(that.vendor_name_name == 1) {					
					if(that.add_data.ipadder == '') {
						that.tips("请先输入集中器号");
						return;
					}
					if(that.add_data.port == '') {
						that.tips("请先输入线路号 ");
						return;
					}
				}
				if(that.vendor_name_name == 2) {					
					that.add_data.ipadder = ''
					that.add_data.port = ''
				}
				$('#add_water_meter_sure').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/addWater",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.code == 200) {
							$('#add_water_meter_sure').attr('disabled', false);
							that.tips_modal = "添加成功";
							$('#myModal_tips').modal('show');
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							$('#add_water_meter_sure').attr('disabled', false);
							that.tips_modal = msg.disp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						$('#add_water_meter_sure').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//水表开阀门
			water_meter_open: function() {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid
				});
				$('#water_meter_open').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/openWater",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#water_meter_open').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("开阀命令已发送");
						} else {
							$('#water_meter_open').attr('disabled', false);
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#water_meter_open').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//水表关阀门
			water_meter_close: function() {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid
				});
				$('#water_meter_close').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/closeWater",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#water_meter_close').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("关阀命令已发送");
						} else {
							$('#water_meter_close').attr('disabled', false);
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#water_meter_close').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//读水表数据
			meter_info_search: function() {
				var that = this;
				var data = JSON.stringify({
					equipsid: that.model_data.equipsid
				});
				$('#meter_info_search').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/selectWaterMeterInfo",
					data: data,
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#meter_info_search').attr('disabled', false);
						if(msg.code == 200) {
							console.log(msg)
							var data_msg = JSON.parse(msg.returnString);
							console.log(that.meter_info)
							$("#myModalremove").modal('hide');
							$("#myModal_meter_info").modal('show');
							that.kind_panduan = data_msg.kind;
							if(data_msg.kind == 1) {
								data_msg.kind = '不带阀';
							} else if(data_msg.kind == 2) {
								data_msg.kind = '带阀';
							}
							if(data_msg.switchstatus == 1) {
								data_msg.switchstatus = '通';
							} else if(data_msg.switchstatus == 0) {
								data_msg.switchstatus = '断';
							}

							if(data_msg.runsts == 0) {
								data_msg.runsts = '正常';
							} else {
								data_msg.runsts = '异常';
							}
							that.meter_info = data_msg;
						} else {

							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#meter_info_search').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//删除
			remove_water_meter: function(tt) {
				console.log(tt)
				var that = this;
				that.data_remove = {
					equipsid: tt.equipsid,
					modifyuserid: that.userid,
					modifyusername: that.createusername
				};
			},
			//删除水表
			sureremove: function() {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/deleteWater",
					data: JSON.stringify(that.data_remove),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.code == 200) {
							console.log(msg)
							that.tips("删除成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							that.tips(msg.disp);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//修改
			fix_water_meter: function(datainfo) {
				var that = this;
				console.log(datainfo);
				that.fix_data = datainfo;
				console.log(that.fix_data);
				if(that.fix_data.issetprice == '单价') {
					that.issetprice2 = 1;
					console.log(datainfo);
				} else if(that.fix_data.issetprice == '阶梯价') {
					that.issetprice2 = 2;
				}
			},
			//确定修改
			fix_water_meter_sure: function() {
				var that = this;
				that.fix_data.issetprice = that.issetprice2;
				that.fix_data.modifyuserid = that.userid;
				that.fix_data.modifyusername = that.createusername;
				if(that.issetprice2 == 1) {
					that.fix_data.ladder1 == '';
					that.fix_data.ladder2 == '';
					that.fix_data.ladder3 == '';
					that.fix_data.price2 == '';
					that.fix_data.price3 == '';
					that.fix_data.price4 == '';
				}
				if(that.issetprice2 == 2) {
					if(that.fix_data.ladder1 == '' || that.fix_data.ladder2 == '' || that.fix_data.ladder3 == '' || that.fix_data.price1 == '' || that.fix_data.price2 == '' || that.fix_data.price3 == '' || that.fix_data.price4 == '') {
						that.tips("请确保三阶四阶已经输入完成");
						return
					}
				}
				var fix_datax_data = {
					equipsid: that.fix_data.equipsid,
					instadr: that.fix_data.instadr,
					issetprice: that.fix_data.issetprice,
					ladder1: that.fix_data.ladder1,
					ladder2: that.fix_data.ladder2,
					ladder3: that.fix_data.ladder3,
					modifyuserid: that.fix_data.modifyuserid,
					modifyusername: that.fix_data.modifyusername,
					price1: that.fix_data.price1,
					price2: that.fix_data.price2,
					price3: that.fix_data.price3,
					price4: that.fix_data.price4,
					thisyearusernum: that.fix_data.thisyearusernum,
				}
				console.log(fix_datax_data);
				$('#fix_water_meter_sure').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/updateWater",
					data: JSON.stringify(fix_datax_data),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#fix_water_meter_sure').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("修改成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {
							$('#fix_water_meter_sure').attr('disabled', false);
							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#fix_water_meter_sure').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//换表
			replace_water_meter: function(data) {
				var that = this;
				that.replace_data.equipsid = data.equipsid;
				that.old_watchno = data.watchno;
			},
			//确认换表
			replace_water_meter_sure: function() {
				var that = this;
				that.replace_data.oldwatchpic = that.imgpath1;
				that.replace_data.modifyuserid = that.userid;
				that.replace_data.modifyusername = that.createusername;
				console.log(that.replace_data);
				$('#replace_water_meter_sure').attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urlr + "/verify/watermeter/changeWater",
					data: JSON.stringify(that.replace_data),
					headers: {
						"userid": that.userid,
						"token": that.token
					},
					async: true,
					dataType: "json",
					success: function(msg) {
						$('#replace_water_meter_sure').attr('disabled', false);
						if(msg.code == 200) {
							that.tips("换表成功");
							$('#myModal_tips').on('hide.bs.modal', function() {
								window.location.reload();
							})
						} else {

							that.tips(msg.disp);
						}
					},
					error: function() {
						$('#replace_water_meter_sure').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
		},

	})
</script>